package com.dgty.dg_common.widget

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.dgty.dg_common.R
import com.dgty.dg_common.bean.ValueBean

/**
 * Title: ScaleAdapter$
 * Description:
 *
 * Created DateTime: 2023/2/15$ 10:04$
 * Created by cacif$.
 */
class ScaleAdapter :
    BaseQuickAdapter<ValueBean, BaseViewHolder>(R.layout.item_mine_personalinfo_scale) {

    override fun convert(holder: BaseViewHolder, item: ValueBean) {
        if (item.check) {
            holder.setBackgroundResource(R.id.view_scale, R.color.black1)
            holder.setTextColorRes(R.id.tv_scale, R.color.black1)
        } else {
            holder.setBackgroundResource(R.id.view_scale, R.color.grey3)
            holder.setTextColorRes(R.id.tv_scale, R.color.grey3)
        }

        holder.setText(R.id.tv_scale, item.value.toString())

        if (item.value == -1) {
            holder.itemView.visibility = View.INVISIBLE
        } else {
            holder.itemView.visibility = View.VISIBLE
        }
    }

}